<template>
	<view class="container">
		<!-- 地址 -->
		<!-- <navigator url="/pages/address/address?source=1" class="address-section">
			<view class="order-content">
				<text class="yticon icon-shouhuodizhi"></text>
				<view class="cen">
					<view class="top">
						<text class="name">{{addressData.name}}</text>
						<text class="mobile">{{addressData.mobile}}</text>
					</view>
					<text class="address">{{addressData.address}} {{addressData.area}}</text>
				</view>
				<text class="yticon icon-you"></text>
			</view>

			<image class="a-bg" src=""></image>
		</navigator> -->

		<view class="goods-section">
			<!-- <view class="g-header b-b">
				<image class="logo" src="http://duoduo.qibukj.cn/./Upload/Images/20190321/201903211727515.png"></image>
				<text class="name">西城小店铺</text>
			</view> -->
			<!-- 商品列表 -->
			<view class="g-item">
				<image :src="formItem.imgUrl"></image>
				<view class="right">
					<text class="title clamp">{{formItem.name}}</text>
					<!-- <text class="spec">{{buyInfo.selected}}</text> -->
					<view class="price-box">
						<text class="price">免费预约</text>
						<!-- <text class="price">￥{{buyInfo.price}}</text> -->
						<!-- <text class="number">x 1</text> -->
					</view>
				</view>
			</view>
		</view>

		<!-- 优惠明细 -->
		<!-- <view class="yt-list">
			<view class="yt-list-cell b-b" @click="toggleMask('show')">
				<view class="cell-icon">
					券
				</view>
				<text class="cell-tit clamp">优惠券</text>
				<text class="cell-tip active">
					选择优惠券
				</text>
				<text class="cell-more wanjia wanjia-gengduo-d"></text>
			</view>
			<view class="yt-list-cell b-b">
				<view class="cell-icon hb">
					减
				</view>
				<text class="cell-tit clamp">商家促销</text>
				<text class="cell-tip disabled">暂无可用优惠</text>
			</view>
		</view> -->
		<!-- 金额明细 -->
		<view class="yt-list">
			<uni-view class="cu-form-group"  @click="toggleSpec">
				<uni-view class="title">预约类型</uni-view>
				<uni-picker>
					<div>
						<uni-view class="picker">
							<view v-if="specSelected.length>0">
								<text class="selected-text" v-for="(sItem, sIndex) in specSelected" :key="sIndex">
									{{sItem.propertyValue}}<span v-if="sIndex+1 !== specSelected.length">,</span>
								</text>
							</view>
							<view v-else>
								请选择预约类型
							</view>
						</uni-view>
					</div>
				</uni-picker>
			</uni-view>
			<view class="cu-form-group">
				<view class="title">预约门店</view>
				<picker @change="PickerChangeStore" :value="indexStore" :range="pickerStore">
					<view class="picker">
						{{indexStore>-1?pickerStore[indexStore]:'请选择预约门店'}}
					</view>
				</picker>
			</view>
			<uni-view class="cu-form-group"  @click="toggleDate">
				<uni-view class="title">预约日期</uni-view>
				<uni-picker>
					<div>
						<uni-view class="picker">{{this.appointmentDate}}</uni-view>
					</div>
				</uni-picker>
			</uni-view>
			<view class="cu-form-group">
				<view class="title">预约时间</view>
				<picker @change="PickerChange" :value="index" :range="picker">
					<view class="picker">
						{{index>-1?picker[index]:'请选择预约时间'}}
					</view>
				</picker>
			</view>
			<!-- <view class="yt-list-cell b-b">
				<text class="cell-tit clamp">预约时间</text>
				<text class="cell-tip">9:00~10:00</text>
				<text class="yticon icon-you"></text>
			</view> -->
			<view class="cu-form-group">
				<view class="title">手机号码</view>
				<input class="desc" style="text-align: right;" type="number" v-model="tel" placeholder="请填写手机号码" placeholder-class="placeholder" />
			</view>
			<view class="cu-form-group">
				<view class="title">备注信息</view>
				<input class="desc" style="text-align: right;" type="text" v-model="remarks" placeholder="请填写备注信息" placeholder-class="placeholder" />
			</view>
		</view>
		
		<!-- 底部 -->
		<view class="footer">
			<!-- <view class="price-content"> -->
				<!-- <text>实付款</text>
				<text class="price-tip">￥</text>
				<text class="price">0</text> -->
				<!-- <text class="price">{{buyInfo.price}}</text> -->
			<!-- </view> -->
			<text class="submit" @click="submit">立即预约</text>
		</view>
		
		<!-- 日历选择器-模态层弹窗 -->
		<view 
			class="popup spec" 
			:class="dateClass"
			@touchmove.stop.prevent="stopPrevent"
			@click="toggleDate"
		>
			<!-- 遮罩层 -->
			<view class="mask"></view>
			<view class="layer attr-content" @click.stop="stopPrevent">
				
				<view @click="cancleMasking" style="-webkit-flex: 1;flex: 1;"></view>
				<!-- 日历组件 -->
				<view class="yt-list">
					<view style="justify-content: flex-end;">
						<calendar :startDate="startDate" :endDate="endDate" :limitFlag="limitFlag" :selectedDate="selectedDate" :showMonth="false" :selected="selected" @change="calendarChange" />
					</view>
				</view>
				<button class="btn" @click="toggleDate">完成</button>
			</view>
		</view>
		<!-- 规格-模态层弹窗 -->
		<view 
			class="popup spec" 
			:class="specClass"
			@touchmove.stop.prevent="stopPrevent"
			@click="toggleSpec"
		>
			<!-- 遮罩层 -->
			<view class="mask"></view>
			<view class="layer attr-content" @click.stop="stopPrevent">
				<view class="a-t">
					<!-- <image src="https://gd3.alicdn.com/imgextra/i3/0/O1CN01IiyFQI1UGShoFKt1O_!!0-item_pic.jpg_400x400.jpg"></image> -->
					<view class="right">
						<!-- <text class="price">¥{{formItem.price}}</text>
						<text class="stock">库存：{{formItem.stock}}件</text> -->
						<view class="selected">
							已选：
							<text class="selected-text" v-for="(sItem, sIndex) in specSelected" :key="sIndex">
								{{sItem.propertyValue}}
							</text>
						</view>
					</view>
				</view>
				<view v-for="(item,index) in specList" :key="index" class="attr-list">
					<text>{{item.propertyName}}</text>
					<view class="item-list">
						<text 
							v-for="(childItem, childIndex) in specChildList" 
							:key="childIndex" class="tit"
							v-if="childItem.pid === item.nameId"
							:class="{selected: childItem.selected,selectedDisplay:childItem.stockType}"
							@click="selectSpec(childIndex,childItem.pid,childItem.selected,childItem.stockType)"
						>
							{{childItem.propertyValue}}
						</text>
					</view>
				</view>
				<button class="btn" @click="toggleSpec">完成</button>
			</view>
		</view>
		<!-- 优惠券面板 -->
		<view class="mask" :class="maskState===0 ? 'none' : maskState===1 ? 'show' : ''" @click="toggleMask">
			<view class="mask-content" @click.stop.prevent="stopPrevent">
				<!-- 优惠券页面，仿mt -->
				<view class="coupon-item" v-for="(item,index) in couponList" :key="index">
					<view class="con">
						<view class="left">
							<text class="title">{{item.title}}</text>
							<text class="time">有效期至2019-06-30</text>
						</view>
						<view class="right">
							<text class="price">{{item.price}}</text>
							<text>满30可用</text>
						</view>
						
						<view class="circle l"></view>
						<view class="circle r"></view>
					</view>
					<text class="tips">限新用户使用</text>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	import xeUtils from 'xe-utils'
	import calendar from '@/components/heqifang-calendar/calendar.vue'
	import { productInfo, insertReserveRecord, selectReserveSetting, selectShopList } from 'api/shop'
	export default {
		components: {
			calendar
		},
		data() {
			return {
				specSelected:[],
				index:-1,
				picker: ['请您先选择预约门店'],
				indexStore:-1,
				pickerStore: ['请选择门店'],
				storeId:'',
				remarks :'',
				buyInfo:[],
				specClass: 'none',
				dateClass:'none',
				specList: [],
				specChildList: [],
				formItem:{},
				maskState: 0, //优惠券面板显示状态
				desc: '', //备注
				payType: 1, //1微信 2支付宝
				couponList: [
					{
						title: '新用户专享优惠券',
						price: 5,
					},
					{
						title: '庆五一发一波优惠券',
						price: 10,
					},
					{
						title: '优惠券优惠券优惠券优惠券',
						price: 15,
					}
				],
				reserveList:[],
				addressData: {
					name: '许小星',
					mobile: '13853989563',
					addressName: '金九大道',
					address: '山东省济南市历城区',
					area: '149号',
					default: false,
				},
				showMonth: false, // 以月份为背景
				isFlag: true,
				startDate : '2020-07-05', // limitFlag == true 有效
				endDate : '2020-07-25',// limitFlag == true 有效
				/* 已选日期 */
				selectedDate: [],
				// 限定可选日期
				limitFlag: true, 
				/* 可选日期 */
				selected : [
					// {date: '2020-04-08', info: '出行', data: { custom: '自定义信息', name: '自定义消息头'}},
					// {date: '2020-04-10', info: '充足', data: { custom: '自定义信息', name: '自定义消息头'}},
				],
				appointmentDate:'请选择预约日期',
				appointmentTime:'',
				tel:'',
				shopList:[],
				shopId:'',
				productId:''
			}
		},
		async onLoad(options){
			console.log(options)
			//接收传值,id里面放的是标题，因为测试数据并没写id 
			let id = options.id;
			if(id){
				this.productId = id
				this.init(id)
				// this.$api.msg(`点击了${id}`);
			}
			// this.buyInfo = JSON.parse(localStorage.getItem('buyInfo'));
			// console.log(this.buyInfo,'123')
			
		
		},
		methods: {
			getCurrentDate() {
			      var myDate = new Date();
			      var days = myDate.getDay();
			      switch(days) {
			            case 1:
			                  days = '星期一';
			                  break;
			            case 2:
			                  days = '星期二';
			                  break;
			            case 3:
			                  days = '星期三';
			                  break;
			            case 4:
			                  days = '星期四';
			                  break;
			            case 5:
			                  days = '星期五';
			                  break;
			            case 6:
			                  days = '星期六';
			                  break;
			            case 0:
			                  days = '星期日';
			                  break;
			      }
			      return days;
			
			},
			opCalendar() {
				this.isFlag = true;
			},
			cancleMasking() {
				this.isFlag = false;
			},
			//两数组取相同的值
			getArrEqual(arr1, arr2) {
			    let newArr = [];
			    for (let i = 0; i < arr2.length; i++) {
			        for (let j = 0; j < arr1.length; j++) {
			            if(arr1[j] === arr2[i]){
			                newArr.push(arr1[j]);
			            }
			        }
			    }
			    return newArr;
			},
			
			//两数组取不同的值
			getArrDifference(arr1, arr2) {
			    return arr1.concat(arr2).filter(function(v, i, arr) {
			        return arr.indexOf(v) === arr.lastIndexOf(v);
			    });
			},
			//规格弹窗开关
			toggleSpec() {
				if(this.specClass === 'show'){
					this.specClass = 'hide';
					setTimeout(() => {
						this.specClass = 'none';
					}, 250);
				}else if(this.specClass === 'none'){
					this.specClass = 'show';
				}
			},
			//日历弹窗开关
			toggleDate() {
				console.log('123')
				if(this.shopId===''||
					this.shopId===undefined||
					this.shopId===null){
					this.$api.msg('请选择预约门店！');
					return false
				}
				if(this.dateClass === 'show'){
					this.dateClass = 'hide';
					setTimeout(() => {
						this.dateClass = 'none';
					}, 250);
				}else if(this.dateClass === 'none'){
					this.dateClass = 'show';
				}
			},
			//预约选择门店
			selectShopListAction(id){
				selectShopList({spuId:id}).then (ret => {
					if(ret.data.errcode === 0){
						this.shopList = ret.data.data.result
						if(this.shopList.length === 0){
							this.$api.msg('预约设置有误，请联系管理员！');
							return false
						}
						for (var i = 0; i < this.shopList.length; i++) {
							this.pickerStore.push(this.shopList[i].storeName)
						}
						console.log(this.pickerStore,'this.pickerStore')
						
						// this.selectReserveSettingAction()
					}else{
						this.$api.msg(ret.data.errmsg);
						return false
					}
				})
			},
			//时间戳转换
			formatDate(date) {
			  var date = new Date(date);
			  var YY = date.getFullYear() + '-';
			  var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
			  var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
			  var hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
			  var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
			  var ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
			  return YY + MM + DD;
			},
			PickerChange(e) {
				console.log(e)
				this.index = e.detail.value
				console.log(this.index,'index')
				console.log(this.picker)
				if(this.index !== 0&&this.index !== -1){
					this.appointmentTime = this.picker[this.index]
					console.log(this.appointmentTime)
				}
			},
			PickerChangeStore(e) {
				console.log(e)
				this.indexStore = e.detail.value
				console.log(this.indexStore,'indexStore')
				console.log(this.pickerStore)
				if(this.indexStore !== 0&&this.indexStore !== -1){
					this.storeId = this.pickerStore[this.indexStore]
					console.log(this.storeId)
					for (var i = 0; i < this.shopList.length; i++) {
						if(this.shopList[i].storeName == this.storeId){
							this.shopId = this.shopList[i].id
							this.selectReserveSettingAction(this.shopList[i].id)
						}
					}
				}
			},
			selectReserveSettingAction(shopId){
				let data = {spuId:this.productId}
				if(shopId){
					data.shopId = shopId
				}
				selectReserveSetting(data).then (ret => {
					if(ret.data.errcode === 0){
						let dataList = ['请选择预约时间']
						let availableDays = ret.data.data.result.availableDays
						
						let startDate = this.formatDate(ret.data.data.result.availableStartTime)
						let endDate = this.formatDate(ret.data.data.result.availableEndTime)
						console.log(startDate+'~'+endDate)
						let today = this.formatDate(new Date())
						let allDate = []
						if(new Date(startDate) > new Date(today)){
							console.log('起始日期大于当天')
							allDate = this.getAllWeak(startDate, endDate)
						}else{
							console.log('起始日期小于当天')
							allDate = this.getAllWeak(today, endDate)
						}
						console.log(allDate,'464')
						let mustStartTime = []
						
						if(ret.data.data.result.mustStartTime){
							let arr = ret.data.data.result.mustStartTime.split(',')
							for (var i = 0; i < arr.length; i++) {
								if(arr[i]>=today){
									console.log(arr[i],'arr[i]')
									mustStartTime.push(arr[i])
								}
							}
						}
						if(mustStartTime.length>0){
							console.log(mustStartTime)
							let dataList = this.getArrDifference(mustStartTime,allDate)
							console.log(dataList,'dataList')
							allDate = dataList
						}
						console.log(allDate,' allDate')
						let allDateList = []
						for (var i = 0; i < allDate.length; i++) {
							allDateList.push({
								'date':allDate[i],
								'week':this.getWeekDate(allDate[i]),
								'info': '充足'
							})
						}
						console.log(allDateList, '组装后的allDateList')
						for (var i = 0; i < allDateList.length; i++) {
							// console.log(availableDays,allDateList, '执行循环')
							if(availableDays.indexOf(allDateList[i].week) != -1){
								// console.log(allDateList[i], '放入数组中的内容')
								this.selected.push(allDateList[i])
							}
						}
						// console.log(this.selected,'组装后的数据')
						
						let arr = ret.data.data.result.detailsList
						// console.log(arr)
						for (var i = 0; i < arr.length; i++) {
							arr[i].newRange = arr[i].availableStartTime+'~'+ arr[i].availableEndTime
							dataList.push(arr[i].newRange)
						}
						console.log(dataList)
						this.picker = dataList
					}else{
						this.$api.msg(ret.data.errmsg);
						return false
					}
				})
			},
			calendarChange(e) {
				console.log(e);
				// 当前选择时间
				let _date = e.fulldate;
				// 判断这个时间是否已选中
				let _index = this.selectedDate.indexOf(_date);
				if(this.selectedDate.length === 0){
					this.selectedDate.push(_date);
				}else{
					this.selectedDate.splice(_index,1);
					this.selectedDate.push(_date);
				}
				this.appointmentDate = this.selectedDate[0]
				console.log(this.appointmentDate,'appointmentDate')
			},
			init(){
				productInfo ({id:this.productId}).then (ret => {
					if(ret.data.errcode === 0){
						this.formItem = ret.data.data
						// uni.setNavigationBarTitle({
						// 	title:this.formItem.name
						// });
						if(ret.data.data.imgList.length>0){
							this.formItem.imgUrl = ret.data.data.imgList[0].url
						}
						this.formItem.stock = 0
						this.skuList = ret.data.data.skuList
						this.specList = ret.data.data.availableAttrs
						this.nameIdlist = xeUtils.clone(this.specList)
						for(let i=0;i<this.skuList.length;i++){
							this.formItem.stock += this.skuList[i].stock
						}
						this.specChildList = []
						for(let i=0;i<ret.data.data.availableAttrs.length;i++){
							for(let j=0;j<ret.data.data.availableAttrs[i].valueList.length;j++){
								this.specChildList.push({
									stockType:false,
									pid:ret.data.data.availableAttrs[i].nameId,
									propertyValue:ret.data.data.availableAttrs[i].valueList[j].propertyValue,
									valueId:ret.data.data.availableAttrs[i].valueList[j].valueId
								})
							}
						}
						this.selectShopListAction(this.productId)
						// this.selectShopListAction(this.productId)
					}
				})	
			},
			//选择规格
			selectSpec(index, pid, selected,stockType){
				if(stockType === true){
					this.$api.msg('此规格库存为0！');
					return false
				}
				console.log(index)
				let list = this.specChildList;
				list.forEach(item=>{
					if(item.pid === pid){
						this.$set(item, 'selected', false);
					}
					item.stockType = false
				})
				if(selected === true){
					this.$set(list[index], 'selected', false);
				}else{
					this.$set(list[index], 'selected', true);
				}
				//存储已选择
				/**
				 * 修复选择规格存储错误
				 * 将这几行代码替换即可
				 * 选择的规格存放在specSelected中
				 */
				this.specSelected = []; 
				list.forEach(item=>{ 
					if(item.selected === true){ 
						this.specSelected.push(item); 
					} 
				})
				console.log(this.specSelected,'选中的规格值valueId')
			
				// 选中规格的valueId
				let arr = []
				for(let i=0;i<this.specSelected.length;i++){
					arr.push(this.specSelected[i].valueId)
				}
				this.createOrderSku = arr
				
				for(let i=0;i<this.skuList.length;i++){
					let newArr = []
					this.skuList[i].count = 0
					for(let j=0;j<this.skuList[i].attrs.length;j++){
						newArr.push(this.skuList[i].attrs[j].valueId)
						this.skuList[i].newArr = newArr
					}
				}
				
				let difference = []
				//商品选中规格与所有规格组比较，每组规格组包含一个选中规格，规格组count+1
				for(let i=0;i<this.skuList.length;i++){
					for(let j=0;j<arr.length;j++){
						if(this.skuList[i].newArr.includes(arr[j])){
							this.skuList[i].count = this.skuList[i].count+1 
						}
					}
				}
				let specListLength = this.specList.length-1
				let array = []
				for(let i=0;i<this.skuList.length;i++){
					if(this.skuList[i].stock === 0&&this.skuList[i].count == specListLength){
						console.log(this.skuList[i].count)
						console.log(this.skuList[i].newArr,'vvvvvvv')
						array.push(this.getArrDifference(this.skuList[i].newArr,arr))
					}
				}
				console.log(array,'差异valueId~~~')
				//库存是0的规格组与选中规格比较，取出两组差异valueId
				for(let i=0;i<this.specChildList.length;i++){
					for(let j=0;j<array.length;j++){
						if(this.specChildList[i].valueId === array[j][0]){
							this.specChildList[i].stockType = true
						}
					}
				}
				console.log(this.specChildList,'组装之后的规格')
				console.log(this.skuList)
				//最终组装数据
				if(this.specList.length === arr.length){
					for(let i=0;i<this.skuList.length;i++){
						if(this.skuList[i].count === arr.length){
							console.log(this.skuList[i],'this.skuList[i]')
							console.log(this.skuList[i].price,'价格')
							console.log(this.skuList[i].stock,'库存')
							this.formItem.price = this.skuList[i].price
							this.formItem.stock = this.skuList[i].stock
							this.formItem.selectSkuId = this.skuList[i].id
						}
					}
				}
				console.log(this.formItem,'000')
			
			},
			//显示优惠券面板
			toggleMask(type){
				let timer = type === 'show' ? 10 : 300;
				let	state = type === 'show' ? 1 : 0;
				this.maskState = 2;
				setTimeout(()=>{
					this.maskState = state;
				}, timer)
			},
			numberChange(data) {
				this.number = data.number;
			},
			changePayType(type){
				this.payType = type;
			},
			submit(){
				let selected = ''
				if(this.specSelected.length===0){
					this.$api.msg('请选择预约类型！');
					return false
				}else{
					for(let i=0;i<this.specSelected.length;i++){
						console.log(i)
						if(i+1 === this.specSelected.length){
							selected += this.specSelected[i].propertyValue
						}else{
							selected += this.specSelected[i].propertyValue+','
						}
					}
				}
				console.log(selected)
				console.log(this.selectedDate,'日期')
				if(this.shopId===''||
					this.shopId===undefined||
					this.shopId===null){
					this.$api.msg('请选择预约门店！');
					return false
				}
				if(this.selectedDate.length===0){
					this.$api.msg('请选择预约日期！');
					return false
				}
				if(this.tel===''||
					this.tel===undefined||
					this.tel===null){
					this.$api.msg('请填写手机号码！');
					return false
				}
				if(this.appointmentTime===''||
					this.appointmentTime===undefined||
					this.appointmentTime===null){
					this.$api.msg('请选择预约时间');
					return false
				}
				let data = {
					'spuId':this.productId,
					'tel':this.tel,
					'reserveDate':this.selectedDate[0],
					'reserveTime':this.appointmentTime,
					'skuId':this.formItem.selectSkuId,
					'goodsName':this.formItem.name+'('+selected+')',
					'shopId':this.shopId,
					// 'totalAmount':this.buyInfo.price,
					// 'receivedAmount':this.buyInfo.price,
					'remarks':this.remarks
				}
				// if(this.buyInfo.skuId !== ''&&this.buyInfo.skuId !==undefined&&this.buyInfo.skuId!==null){
				// 	data.skuId=this.buyInfo.skuId
				// 	data.goodsName = this.formItem.name+'('+this.buyInfo.selected+')'
				// }
				insertReserveRecord (data).then (ret => {
					if(ret.data.errcode === 0){
						uni.redirectTo({
							url: '/pages/appointment/appointment_list'
						})
					}else{
						this.$api.msg(ret.data.errmsg);
						return false
					}
				})
			},
			stopPrevent(){},
			
			// 获取当前日期星期几
			getWeekDate(time) {
			  time = xeUtils.toDateString(time, 'yyyy-MM-dd')
			  var now = new Date(time)
			  var day = now.getDay()
			  // 1-星期日
			  // 2-星期一
			  // 3-星期二
			  // 4-星期三
			  // 5-星期四
			  // 6-星期五
			  // 7-星期六
			  var weeks = [1, 2, 3, 4, 5, 6, 7]
			  var week = weeks[day]
			  return week
			},
		
			//获取某一时间段内的所有日期
			getAllWeak(start_time,end_time){
				var begin = new Date(start_time), end = new Date(end_time);
				var begin_time = begin.getTime(), end_time = end.getTime(), time_diff = end_time - begin_time;
				var all_d = [];
				for (var i = 0; i <= time_diff; i += 86400000){
				    var ds = new Date(begin_time + i);
					let m = ''
					let d = ''
					if((ds.getMonth()+1) < 10){
						m = '0'+(ds.getMonth()+1)
					}else{
						m = ds.getMonth()+1
					}
					if(ds.getDate() < 10){
						d = '0'+ds.getDate()
					}else{
						d= ds.getDate()
					}
				    all_d.push(ds.getFullYear()+"-"+m+"-"+d);
				}
				return all_d;
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: $page-color-base;
		padding-bottom: 100upx;
	}

	.address-section {
		padding: 30upx 0;
		background: #fff;
		position: relative;

		.order-content {
			display: flex;
			align-items: center;
		}

		.icon-shouhuodizhi {
			flex-shrink: 0;
			display: flex;
			align-items: center;
			justify-content: center;
			width: 90upx;
			color: #888;
			font-size: 44upx;
		}

		.cen {
			display: flex;
			flex-direction: column;
			flex: 1;
			font-size: 28upx;
			color: $font-color-dark;
		}

		.name {
			font-size: 34upx;
			margin-right: 24upx;
		}

		.address {
			margin-top: 16upx;
			margin-right: 20upx;
			color: $font-color-light;
		}

		.icon-you {
			font-size: 32upx;
			color: $font-color-light;
			margin-right: 30upx;
		}

		.a-bg {
			position: absolute;
			left: 0;
			bottom: 0;
			display: block;
			width: 100%;
			height: 5upx;
		}
	}

	.goods-section {
		// margin-top: 16upx;
		background: #fff;
		padding-bottom: 1px;

		.g-header {
			display: flex;
			align-items: center;
			height: 84upx;
			padding: 0 30upx;
			position: relative;
		}

		.logo {
			display: block;
			width: 50upx;
			height: 50upx;
			border-radius: 100px;
		}

		.name {
			font-size: 30upx;
			color: $font-color-base;
			margin-left: 24upx;
		}

		.g-item {
			display: flex;
			margin: 0upx 30upx;
			padding-top: 20upx;

			image {
				flex-shrink: 0;
				display: block;
				width: 140upx;
				height: 140upx;
				border-radius: 4upx;
			}

			.right {
				flex: 1;
				padding-left: 24upx;
				overflow: hidden;
			}

			.title {
				font-size: 30upx;
				color: $font-color-dark;
			}

			.spec {
				font-size: 26upx;
				color: $font-color-light;
			}

			.price-box {
				display: flex;
				align-items: center;
				font-size: 30upx;
				color: $font-color-dark;
				padding-top: 10upx;

				.price {
					margin-bottom: 4upx;
				}
				.number{
					font-size: 26upx;
					color: $font-color-base;
					margin-left: 20upx;
				}
			}

			.step-box {
				position: relative;
			}
		}
	}
	.yt-list {
		margin-top: 16upx;
		background: #fff;
	}

	.yt-list-cell {
		display: flex;
		align-items: center;
		padding: 10upx 30upx 10upx 40upx;
		line-height: 70upx;
		position: relative;

		&.cell-hover {
			background: #fafafa;
		}

		&.b-b:after {
			left: 30upx;
		}

		.cell-icon {
			height: 32upx;
			width: 32upx;
			font-size: 22upx;
			color: #fff;
			text-align: center;
			line-height: 32upx;
			background: #f85e52;
			border-radius: 4upx;
			margin-right: 12upx;

			&.hb {
				background: #ffaa0e;
			}

			&.lpk {
				background: #3ab54a;
			}

		}

		.cell-more {
			align-self: center;
			font-size: 24upx;
			color: $font-color-light;
			margin-left: 8upx;
			margin-right: -10upx;
		}

		.cell-tit {
			flex: 1;
			font-size: 26upx;
			color: $font-color-light;
			margin-right: 10upx;
		}

		.cell-tip {
			font-size: 26upx;
			color: $font-color-dark;

			&.disabled {
				color: $font-color-light;
			}

			&.active {
				color: $base-color;
			}
			&.red{
				color: $base-color;
			}
		}

		&.desc-cell {
			.cell-tit {
				max-width: 90upx;
			}
		}

		.desc {
			flex: 1;
			font-size: $font-base;
			color: $font-color-dark;
		}
	}
	
	/* 支付列表 */
	.pay-list{
		padding-left: 40upx;
		margin-top: 16upx;
		background: #fff;
		.pay-item{
			display: flex;
			align-items: center;
			padding-right: 20upx;
			line-height: 1;
			height: 110upx;	
			position: relative;
		}
		.icon-weixinzhifu{
			width: 80upx;
			font-size: 40upx;
			color: #6BCC03;
		}
		.icon-alipay{
			width: 80upx;
			font-size: 40upx;
			color: #06B4FD;
		}
		.icon-xuanzhong2{
			display: flex;
			align-items: center;
			justify-content: center;
			width: 60upx;
			height: 60upx;
			font-size: 40upx;
			color: $base-color;
		}
		.tit{
			font-size: 32upx;
			color: $font-color-dark;
			flex: 1;
		}
	}
	
	.footer{
		position: fixed;
		left: 0;
		bottom: 0;
		z-index: 995;
		display: flex;
		align-items: center;
		width: 100%;
		height: 90upx;
		justify-content: space-between;
		font-size: 30upx;
		background-color: #fff;
		z-index: 99;
		color: $font-color-base;
		box-shadow: 0 -1px 5px rgba(0,0,0,.1);
		.price-content{
			padding-left: 30upx;
		}
		.price-tip{
			color: $base-color;
			margin-left: 8upx;
		}
		.price{
			font-size: 36upx;
			color: $base-color;
		}
		.submit{
			display:flex;
			align-items:center;
			justify-content: center;
			width: 100%;
			height: 100%;
			color: #fff;
			font-size: 32upx;
			background-color: $base-color;
		}
	}
	
	/* 优惠券面板 */
	.mask{
		display: flex;
		align-items: flex-end;
		position: fixed;
		left: 0;
		top: var(--window-top);
		bottom: 0;
		width: 100%;
		background: rgba(0,0,0,0);
		z-index: 9995;
		transition: .3s;
		
		.mask-content{
			width: 100%;
			min-height: 30vh;
			max-height: 70vh;
			background: #f3f3f3;
			transform: translateY(100%);
			transition: .3s;
			overflow-y:scroll;
		}
		&.none{
			display: none;
		}
		&.show{
			background: rgba(0,0,0,.4);
			
			.mask-content{
				transform: translateY(0);
			}
		}
	}

	/* 优惠券列表 */
	.coupon-item{
		display: flex;
		flex-direction: column;
		margin: 20upx 24upx;
		background: #fff;
		.con{
			display: flex;
			align-items: center;
			position: relative;
			height: 120upx;
			padding: 0 30upx;
			&:after{
				position: absolute;
				left: 0;
				bottom: 0;
				content: '';
				width: 100%;
				height: 0;
				border-bottom: 1px dashed #f3f3f3;
				transform: scaleY(50%);
			}
		}
		.left{
			display: flex;
			flex-direction: column;
			justify-content: center;
			flex: 1;
			overflow: hidden;
			height: 100upx;
		}
		.title{
			font-size: 32upx;
			color: $font-color-dark;
			margin-bottom: 10upx;
		}
		.time{
			font-size: 24upx;
			color: $font-color-light;
		}
		.right{
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			font-size: 26upx;
			color: $font-color-base;
			height: 100upx;
		}
		.price{
			font-size: 44upx;
			color: $base-color;
			&:before{
				content: '￥';
				font-size: 34upx;
			}
		}
		.tips{
			font-size: 24upx;
			color: $font-color-light;
			line-height: 60upx;
			padding-left: 30upx;
		}
		.circle{
			position: absolute;
			left: -6upx;
			bottom: -10upx;
			z-index: 10;
			width: 20upx;
			height: 20upx;
			background: #f3f3f3;
			border-radius: 100px;
			&.r{
				left: auto;
				right: -6upx;
			}
		}
	}
	.appointment-date-item::after{
		font-family: cuIcon;
		display: block;
		content: "\e6a3";
		position: absolute;
		font-size: 17px;
		color: #8799a3;
		line-height: 50px;
		width: 30px;
		text-align: center;
		top: 0;
		bottom: 0;
		right: -10px;
		margin: auto;
	}
	
	/*  弹出层 */
	.popup {
		position: fixed;
		left: 0;
		top: 0;
		right: 0;
		bottom: 0;
		z-index: 99;
		
		&.show {
			display: block;
			.mask{
				animation: showPopup 0.2s linear both;
			}
			.layer {
				animation: showLayer 0.2s linear both;
			}
		}
		&.hide {
			.mask{
				animation: hidePopup 0.2s linear both;
			}
			.layer {
				animation: hideLayer 0.2s linear both;
			}
		}
		&.none {
			display: none;
		}
		.mask{
			position: fixed;
			top: 0;
			width: 100%;
			height: 100%;
			z-index: 1;
			background-color: rgba(0, 0, 0, 0.4);
		}
		.layer {
			position: fixed;
			z-index: 99;
			bottom: 0;
			width: 100%;
			// min-height: 40vh;
			border-radius: 10upx 10upx 0 0;
			background-color: #fff;
			.btn{
				height: 66upx;
				line-height: 66upx;
				border-radius: 100upx;
				background: $uni-color-primary;
				font-size: $font-base + 2upx;
				color: #fff;
				margin: 30upx auto 20upx;
			}
		}
		@keyframes showPopup {
			0% {
				opacity: 0;
			}
			100% {
				opacity: 1;
			}
		}
		@keyframes hidePopup {
			0% {
				opacity: 1;
			}
			100% {
				opacity: 0;
			}
		}
		@keyframes showLayer {
			0% {
				transform: translateY(120%);
			}
			100% {
				transform: translateY(0%);
			}
		}
		@keyframes hideLayer {
			0% {
				transform: translateY(0);
			}
			100% {
				transform: translateY(120%);
			}
		}
	}
	/* 规格选择弹窗 */
	.attr-content{
		padding: 10upx;
		.a-t{
			display: flex;
			image{
				width: 170upx;
				height: 170upx;
				flex-shrink: 0;
				margin-top: -40upx;
				border-radius: 8upx;;
			}
			.right{
				display: flex;
				flex-direction: column;
				// padding-left: 24upx;
				font-size: $font-sm + 2upx;
				color: $font-color-base;
				line-height: 42upx;
				.price{
					font-size: $font-lg;
					color: $uni-color-primary;
					margin-bottom: 10upx;
				}
				.selected-text{
					margin-right: 10upx;
				}
			}
		}
		.attr-list{
			display: flex;
			flex-direction: column;
			font-size: $font-base + 2upx;
			color: $font-color-base;
			padding-top: 30upx;
			padding-left: 10upx;
		}
		.item-list{
			padding: 20upx 0 0;
			display: flex;
			flex-wrap: wrap;
			text{
				display: flex;
				align-items: center;
				justify-content: center;
				background: #eee;
				margin-right: 20upx;
				margin-bottom: 20upx;
				border-radius: 100upx;
				min-width: 60upx;
				height: 60upx;
				padding: 0 20upx;
				font-size: $font-base;
				color: $font-color-dark;
			}
			.selected{
				background: #fbebee;
				color: $uni-color-primary;
			}
			.selectedDisplay{
				background: #FFFFFF;
				border: 1px solid #DDDDDD !important;
				color: #DDDDDD !important;
			}
		}
	}
</style>